#!/usr/bin/env bats

@test "filter around color no-case: 2 words" {
  cd $BATS_TEST_DIRNAME
  expected="file11-1-for the rest of his life. Luckily, nature has a better idea. Over time, as
file11-2-upsets swamp him, he becomes able to use those neural pathways he's building
file11:3:to soothe himself. The more oxytocin he [01;31m[Kreleases[m[K in response to your loving
file11-4-attention, for instance, the more oxytocin receptors he [0;32mmakes[0m, and the more
file11-5-easily he can calm himself and feel good. He's even beginning to create nerve"
  result="$(fish -c 'tbgs releases makes')"; [ "$result" = "$expected" ]
  expected="file11-1-for the rest of his life. Luckily, nature [0;32mha[0ms a better idea. Over time, as
file11:2:upsets swamp him, he becomes able to use those neural pathways he's [01;31m[Kbuild[m[King
file11-3-to soothe himself. The more oxytocin he releases in response to your loving
file11-4-attention, for instance, the more oxytocin receptors he makes, and the more
--
file11-6-connections t[0;32mha[0mt allow his prefrontal cortex (the beginnings of his thinking
file11-7-brain) to counteract alarms in his amygdala (part of the emotional brain).
file11:8:You're the facilitator for your baby to [01;31m[Kbuild[m[K a brain and nervous system t[0;32mha[0mt
file11-9-makes it easy for him to manage his anxiety for the rest of his life.
file11-10-Anyone who's ever spent time with a newborn knows they can be difficult to"
  result="$(fish -c 'tbgs build ha')"; [ "$result" = "$expected" ]
}

@test "filter around color no-case: 4 words" {
  cd $BATS_TEST_DIRNAME
  expected="file11-12-perfect. Human parents never are. [0;34mYou[0m only have to be good enough, so that most
file11-13-of the time [0;34myou[0m show up in a soothing way [0;33mwhen[0m [0;34myou[0mr baby needs [0;34myou[0m. It means
file11:14:[0;34myou[0m hold him while he cries and offer him what we [01;31m[Kall[m[K need [0;33mwhen[0m we're in
file11-15-distress: a compassionate witness.
file11-16-Even if [0;34myou[0mr little one keeps crying while [0;34myou[0m hold [0;32mher[0m, she feels [0;34myou[0mr arms
file11-17-around [0;32mher[0m. This is very different from the uncomforted crying that is so
file11-18-stressful to infants. She may be in pain or she may simply be overstimulated
file11:19:and need to release [01;31m[Kall[m[K those pent-up stresses of being newly alive in an
file11-20-overwhelming world. Eit[0;32mher[0m way, [0;34myou[0mr presence is doing its job, giving [0;32mher[0m the
file11:21:safety to express [0;32mher[0m emotions—and to feel heard. This crying actu[01;31m[Kall[m[Ky releases
file11-22-stress hormones. Think of it this way: She had a hard day, or (even months ago)
file11-23-a hard birth, and she wants to tell [0;34myou[0m about it. She may be crying, but it’s a
file11:24:good, cleansing cry. She’s releasing [01;31m[Kall[m[K the cortisol, adrenaline, and ot[0;32mher[0m
file11-25-pent-up stress hormones from [0;32mher[0m overstimulating experiences in this crazy new
file11-26-world. Because [0;34myou[0m’re holding [0;32mher[0m, [0;32mher[0m body is responding to [0;32mher[0m crying by"
  result="$(fish -c 'tbgs all her when you')"; [ "$result" = "$expected" ]
  expected="file11-1-for the rest of his life. Luckily, nature has a better idea. Over time, as
file11-2-upsets swamp him, he becomes able to use those neural pathways he's building
file11:3:to soothe himself. The more oxytocin he releases in response to [01;31m[Kyou[m[Kr loving
file11-4-attention, for instance, the more oxytocin receptors he makes, and the more
file11-5-easily he can calm himself and feel good. He's even beginning to create nerve
file11-6-connections that [0;32mall[0mow his prefrontal cortex (the beginnings of his thinking
file11-7-brain) to counteract alarms in his amygdala (part of the emotional brain).
file11:8:[01;31m[KYou[m[K're the facilitator for [01;31m[Kyou[m[Kr baby to build a brain and nervous system that
file11-9-makes it easy for him to manage his anxiety for the rest of his life.
file11-10-Anyone who's ever spent time with a newborn knows they can be difficult to
file11:11:soothe. Don't worry. [01;31m[KYou[m[Kr baby's brain development doesn't require that [01;31m[Kyou[m[K be
file11:12:perfect. Human parents never are. [01;31m[KYou[m[K only have to be good enough, so that most
file11:13:of the time [01;31m[Kyou[m[K show up in a soothing way [0;34mwhen[0m [01;31m[Kyou[m[Kr baby needs [01;31m[Kyou[m[K. It means
file11:14:[01;31m[Kyou[m[K hold him while he cries and offer him what we [0;32mall[0m need [0;34mwhen[0m we're in
file11-15-distress: a compassionate witness.
file11:16:Even if [01;31m[Kyou[m[Kr little one keeps crying while [01;31m[Kyou[m[K hold [0;33mher[0m, she feels [01;31m[Kyou[m[Kr arms
file11-17-around [0;33mher[0m. This is very different from the uncomforted crying that is so
file11-18-stressful to infants. She may be in pain or she may simply be overstimulated
file11-19-and need to release [0;32mall[0m those pent-up stresses of being newly alive in an
file11:20:overwhelming world. Eit[0;33mher[0m way, [01;31m[Kyou[m[Kr presence is doing its job, giving [0;33mher[0m the
file11-21-safety to express [0;33mher[0m emotions—and to feel heard. This crying actu[0;32mall[0my releases
file11-22-stress hormones. Think of it this way: She had a hard day, or (even months ago)
file11:23:a hard birth, and she wants to tell [01;31m[Kyou[m[K about it. She may be crying, but it’s a
file11-24-good, cleansing cry. She’s releasing [0;32mall[0m the cortisol, adrenaline, and ot[0;33mher[0m
file11-25-pent-up stress hormones from [0;33mher[0m overstimulating experiences in this crazy new
file11:26:world. Because [01;31m[Kyou[m[K’re holding [0;33mher[0m, [0;33mher[0m body is responding to [0;33mher[0m crying by
file11-27-building"
  result="$(fish -c 'tbgs you all her when')"; [ "$result" = "$expected" ]
  expected="file11-11-soothe. Don't worry. [0;32mYou[0mr baby's brain development doesn't require that [0;32myou[0m be
file11-12-perfect. Human parents never are. [0;32mYou[0m only have to be good enough, so that most
file11:13:of the time [0;32myou[0m show up in a soothing way [01;31m[Kwhen[m[K [0;32myou[0mr baby needs [0;32myou[0m. It means
file11:14:[0;32myou[0m hold him while he cries and offer him what we [0;33mall[0m need [01;31m[Kwhen[m[K we're in
file11-15-distress: a compassionate witness.
file11-16-Even if [0;32myou[0mr little one keeps crying while [0;32myou[0m hold [0;34mher[0m, she feels [0;32myou[0mr arms"
  result="$(fish -c 'tbgs when you all her')"; [ "$result" = "$expected" ]
  expected="file11-14-[0;33myou[0m hold him while he cries and offer him what we [0;34mall[0m need [0;32mwhen[0m we're in
file11-15-distress: a compassionate witness.
file11:16:Even if [0;33myou[0mr little one keeps crying while [0;33myou[0m hold [01;31m[Kher[m[K, she feels [0;33myou[0mr arms
file11:17:around [01;31m[Kher[m[K. This is very different from the uncomforted crying that is so
file11-18-stressful to infants. She may be in pain or she may simply be overstimulated
file11-19-and need to release [0;34mall[0m those pent-up stresses of being newly alive in an
file11:20:overwhelming world. Eit[01;31m[Kher[m[K way, [0;33myou[0mr presence is doing its job, giving [01;31m[Kher[m[K the
file11:21:safety to express [01;31m[Kher[m[K emotions—and to feel heard. This crying actu[0;34mall[0my releases
file11-22-stress hormones. Think of it this way: She had a hard day, or (even months ago)
file11-23-a hard birth, and she wants to tell [0;33myou[0m about it. She may be crying, but it’s a
file11:24:good, cleansing cry. She’s releasing [0;34mall[0m the cortisol, adrenaline, and ot[01;31m[Kher[m[K
file11:25:pent-up stress hormones from [01;31m[Kher[m[K overstimulating experiences in this crazy new
file11:26:world. Because [0;33myou[0m’re holding [01;31m[Kher[m[K, [01;31m[Kher[m[K body is responding to [01;31m[Kher[m[K crying by
file11-27-building"
  result="$(fish -c 'tbgs her when you all')"; [ "$result" = "$expected" ]
}

@test "filter around color no-case: 2 words partial match" {
  cd $BATS_TEST_DIRNAME
  expected="file11-8-You're the facilitator for your baby to build a brain and nervous system that
file11-9-makes it easy for him to manage his an[0;32mxiet[0my for the rest of his life.
file11:10:Anyone who's ever spent time with a n[01;31m[Kewbor[m[Kn knows they can be difficult to
file11-11-soothe. Don't worry. Your baby's brain development doesn't require that you be
file11-12-perfect. Human parents never are. You only have to be good enough, so that most"
  result="$(fish -c 'tbgs ewbor xiet')"; [ "$result" = "$expected" ]
}

@test "filter around color no-case: 2 words word only appears in file path" {
  cd $BATS_TEST_DIRNAME
  expected=""
  result="$(fish -c 'tbgs the file')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs file never')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Because file')"; [ "$result" = "$expected" ]
}
